# 包含配置文件
source $PWD/base/config.sh

# 创建数据库语句
create_database="CREATE DATABASE "$local_new_database_name" CHARACTER SET "$local_new_database_character" COLLATE "$local_new_database_collate";"
# 创建用户语句
create_user=""
# 删除数据库语句
drop_database="DROP DATABASE IF EXISTS "$local_new_database_name";"
# 删除用户语句
drop_user=""
case $server in
        $mysqlServer)
                create_user="CREATE USER '"$local_new_user_name"'@'%' IDENTIFIED WITH mysql_native_password BY '"$local_new_user_password"';"
                drop_user="DROP USER IF EXISTS "$local_new_user_name";"
                ;;
        $mariadbServer)
                create_user="CREATE USER '"$local_new_user_name"'@'%' IDENTIFIED BY '"$local_new_user_password"';"
                ;;
        *)
                echo 'config.sh文件中server属性无效！'
                exit 1
                ;;
esac

# 授予DBA权限
grant_dba_privilege="GRANT "$local_new_user_dba_privilege" ON *.* TO '"$local_new_user_name"'@'%';"
# 授予表权限
grant_table_privilege="GRANT "$local_new_user_table_privilege" ON "$local_new_database_name".* TO '"$local_new_database_name"'@'%';"
# 授予其他权限
grant_other_privilege="GRANT "$local_new_user_other_privilege" ON "$local_new_database_name".* TO '"$local_new_database_name"'@'%';"

# 刷新权限语句
flush_privilege="FLUSH PRIVILEGES;"

# 密码策略
set_validate_password_policy="SET GLOBAL validate_password.policy = "$validate_password_policy";"
# 密码长度
set_validate_password_length="SET GLOBAL validate_password.length = "$validate_password_length";"
